package com.ark.frigate.zookeeper.ext;

import org.springframework.beans.BeansException;
import org.springframework.beans.PropertyValues;
import org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessor;
import org.springframework.stereotype.Component;

import lombok.extern.slf4j.Slf4j;

/**
 * @Author ZengWeiLong
 * @Description Copy Right Beryonca
 * @Date 2023/2/15 1:41 PM
 * @Version 1.0
 */
@Slf4j
@Component
public class A6InstantitionAwareBeanPostProcessor implements InstantiationAwareBeanPostProcessor {
    @Override
    public Object postProcessBeforeInstantiation(Class<?> beanClass, String beanName) throws BeansException {
        log.info("====6=InstantiationAwareBeanPostProcessor.postProcessBeforeInstantiation Class<?>");
        return InstantiationAwareBeanPostProcessor.super.postProcessBeforeInstantiation(beanClass, beanName);
    }

    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
        log.info("====6=InstantiationAwareBeanPostProcessor.postProcessBeforeInitialization Object={}", beanName);
        return InstantiationAwareBeanPostProcessor.super.postProcessBeforeInitialization(bean, beanName);
    }

    @Override
    public boolean postProcessAfterInstantiation(Object bean, String beanName) throws BeansException {
        log.info("====6=InstantiationAwareBeanPostProcessor.postProcessAfterInstantiation Object={}", beanName);
        return InstantiationAwareBeanPostProcessor.super.postProcessAfterInstantiation(bean, beanName);
    }

    @Override
    public PropertyValues postProcessProperties(PropertyValues pvs, Object bean, String beanName)
            throws BeansException {
        log.info("====6=InstantiationAwareBeanPostProcessor.postProcessProperties PropertyValues={}", beanName);
        return InstantiationAwareBeanPostProcessor.super.postProcessProperties(pvs, bean, beanName);
    }

    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        log.info("====6=InstantiationAwareBeanPostProcessor.postProcessAfterInitialization PropertyValues={}",
                beanName);
        return InstantiationAwareBeanPostProcessor.super.postProcessAfterInitialization(bean, beanName);
    }
}
